import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'

const routes: RouteRecordRaw[] = [
    {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/Login.vue')
    },
    {
        path: '/',
        component:() => import('@layout/index.vue'),
        redirect: '/home',
        meta: {title: '布局', show: false},
        children: [
            {
                path: '/home',
                name: 'Home',
                component:() => import('@views/Home.vue'),
                meta: {title: '首页', show: true}
            },
            {
                path: '/async',
                name: 'Async',
                component:() => import('@views/Async.vue'),
                meta: {title: '异步组件', show: true}
            },
            {
                path: '/directive',
                name: 'Directive',
                component: () => import('@views/Directive.vue'),
                meta: {title: '自定义指令', show: true}
            },
            {
                path: '/lazy',
                name: 'LazyImg',
                component: () => import('@views/LazyImg.vue'),
                meta: {title: '懒加载图片', show: true}
            },
            {
                path: '/resize',
                name: 'resize',
                component: () => import('@views/Resize.vue'),
                meta: {title: '监听尺寸变化', show: true}
            },
            {
                path: '/jsx',
                name: 'JsxDemo',
                component: () => import('@views/JsxDemo.vue'),
                meta: {title: 'JSX用法', show: true}
            },
            {
                path: '/h',
                name: 'HFunction',
                component: () => import('@views/HFunction.vue'),
                meta: {title: 'h函数用法', show: true}
            },
            {
                path: '/concurrent',
                name: 'Concurrent',
                component: () => import('@/views/Concurrent.vue'),
                meta: {title: '并发请求', show: true}
            }
        ]
    },

]
const router = createRouter({
    history: createWebHistory(),
    routes
})
export default router